
import { createApp } from 'vue'
import { createPinia } from 'pinia'
import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'
import * as ElementPlusIconsVue from '@element-plus/icons-vue'

import App from './App.vue'
import router from './router'
import axios from "axios";
// 在 main.js 中配置 axios
axios.defaults.baseURL = 'http://localhost:8080'
axios.interceptors.response.use(
    response => response,
    error => {
      if (error.response?.status === 401) {
        // 处理未授权
      }
      return Promise.reject(error)
    }
)
const app = createApp(App)

app.use(createPinia())

// 注册所有图标
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
  app.component(key, component)
}

app.use(ElementPlus)
app.use(router)

app.mount('#app')
